feat: add integration tests with docker-compose (#7)#20
Merged
Conversation
…er, fetch, exec, seed PostgreSQL/MySQL with cross-table refs, idempotency, reset, create database/schema, create-if-missing tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive integration testing infrastructure using Docker Compose to test initium against real database services. It introduces 18 end-to-end tests covering all major commands (wait-for, render, fetch, exec, seed) with PostgreSQL 16, MySQL 8.0, and nginx services.
Changes:
- Added 18 integration tests for wait-for (TCP/HTTP/timeout/multiple targets), render, fetch, exec, and seed operations with PostgreSQL and MySQL
- Created Docker Compose configuration with Postgres 16, MySQL 8.0, and nginx services with health checks
- Added separate GitHub Actions workflow for integration tests using service containers
- Enhanced database interface to properly handle auto-increment ID columns in seed operations
- Updated documentation with integration test instructions and test scenario table
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration_test.rs | New integration test suite with 18 tests covering all major commands and database operations |
| tests/fixtures/template.conf.tmpl | Template fixture for testing render command with environment variable substitution |
| tests/fixtures/seed-postgres.yaml | PostgreSQL seed specification with cross-table references for testing seed functionality |
| tests/fixtures/seed-mysql.yaml | MySQL seed specification with cross-table references for testing seed functionality |
| tests/docker-compose.yml | Service definitions for Postgres, MySQL, and nginx with health checks on non-standard ports |
| tests/README.md | Documentation for running unit and integration tests with scenario descriptions |
| src/seed/executor.rs | Passes auto_id column name to database layer for proper ID retrieval |
| src/seed/db.rs | Enhanced insert_row to accept auto_id_column parameter for RETURNING clause in PostgreSQL |
| CHANGELOG.md | Documented new integration testing infrastructure and test coverage |
| .github/workflows/integration.yml | CI workflow for integration tests with service containers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
Changes
tests/docker-compose.yml— Postgres 16, MySQL 8.0, nginx servicestests/fixtures/— seed-postgres.yaml, seed-mysql.yaml, template.conf.tmpl.github/workflows/integration.yml— CI workflow with service containersCHANGELOG.mdandtests/README.mdHow to verify
All 29 tests pass (11 unit + 18 integration), clippy clean, fmt clean.